﻿namespace pay.sofort.test
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class TestConfig
    {
        [TestMethod]
        public void TestConfigWriteRead()
        {
            TPaySofortConfig config = new TPaySofortConfig
            {
                Konfigurationsschluessel = "11111:2222222:9e81ca8af371e806a9be01a8d120d62b",
                ConnectionString = "data source=localhost;initial catalog=Sofort;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework",
                SuccessUrl = "http://www.shop.de/confirm.aspx",
                AbortUrl = "http://www.shop.de/abort.aspx",
                TimeoutUrl = "http://www.shop.de/timeout.aspx",
                Notification_url_1 = "http://www.shop.de/notify.ashx?received",
                Notification_url_1_notify_on = "received",
                Notification_url_2 = "http://www.shop.de/notify.ashx?loss+pending+refunded",
                Notification_url_2_notify_on = "loss,pending,refunded",
            };

            config.WriteToFile("sofort.xml");

            TPaySofortConfig config2 = TPaySofortConfig.LoadFromFile("sofort.xml");
            Assert.IsNotNull(config2);

            TPaySofortConfig config3 = TPaySofortConfig.LoadFromFile();
            Assert.IsNotNull(config3);
        }
    }
}
